import axios from 'axios';

var updateNoteService = {};
// process.env.API_HOST

// 查询updateNote信息
updateNoteService.search = function (index, pagesize) {
    let data = {
        pageIndex: index,
        pageSize: pagesize,
    }
    return axios.post(process.env.API_HOST + "admin/updatenote/search", data)
        .then(function (res) {
            return res;
        })
        .catch(function (error) {
            throw error;
        })
};
// 添加一条信息
updateNoteService.add = function (main) {
    let data = {
        main: main,
    }
    return axios.post(process.env.API_HOST + "admin/updatenote/add", data)
        .then(function (res) {
            return res;
        })
        .catch(function (error) {
            throw error;
        })
};
// 删除一条信息
updateNoteService.deleteOnce = function (id) {
    let data = {
        id: id,
    }
    return axios.post(process.env.API_HOST + "admin/updatenote/deleteOnce", data)
        .then(function (res) {
            return res;
        })
        .catch(function (error) {
            throw error;
        })
};
// 删除多条信息
updateNoteService.deleteMany = function (id) {
    let data = {
        id: id,
    }
    return axios.post(process.env.API_HOST + "admin/updatenote/deleteMany", data)
        .then(function (res) {
            return res;
        })
        .catch(function (error) {
            throw error;
        })
};
// 更新一条信息
updateNoteService.updateOnce = function (id, main) {
    let data = {
        id: id,
        main: main,
    }
    return axios.post(process.env.API_HOST + "admin/updatenote/updateOnce", data)
        .then(function (res) {
            return res;
        })
        .catch(function (error) {
            throw error;
        })
};
export default updateNoteService;
